package com.alks.function.data.vo.sys;

import cn.hutool.extra.spring.SpringUtil;
import com.alks.function.config.DatabaseMessageSource;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.context.i18n.LocaleContextHolder;

/**
 * @author: chen
 * @date: 2024/12/26
 * @description: 语言配置VO
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class LangTypeVO {

    private String code;

    private String name;

    public String getName() {
        return SpringUtil.getBean(DatabaseMessageSource.class)
                .getMessage(this.code, null, LocaleContextHolder.getLocale());
    }
}
